﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PRO.Entity;
using PRO.DbProvider;
using System.Data;
using PRO.ORM;

namespace PRO.Product
{
    public class ProductLib
    {
        public static int AddProduct(ProductInfo info)
        {
            return DataBaseProvider.GetInstance().AddProduct(info);
        }
        /// <summary>
        /// 获取产品信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static ProductInfo GetProductInfo(int id)
        {
            ProductInfo info = new ProductInfo();
            DataTable dt= DataBaseProvider.GetInstance().GetProductInfo(id);
            if (dt != null && dt.Rows.Count > 0)
                info.BindDataToEntity(dt);
            return info;
        }
        public static bool EditProduct(ProductInfo info)
        {
            return DataBaseProvider.GetInstance().EditProduct(info);
        }
        public static bool DelProduct(int id)
        {
            return DataBaseProvider.GetInstance().DelProduct(id);
        }
    }
}
